@extends('admin.base')
	@section('content')
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            <i class="fa fa-calendar"></i>
			商品信息管理 
          </h1>
          <ol class="breadcrumb">
            <li><a href="{{url('admin')}}"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li><a href="#">商品信息管理</a></li>
            <li class="active">添加商品信息详情</li>
          </ol>
        </section>
		
        <!-- Main content -->
        <section class="content">
          <div class="row">
            <!-- right column -->
            <div class="col-md-12">
              <!-- Horizontal Form -->
              <div class="box box-primary">
                <div class="box-header with-border">
                  <h3 class="box-title"><i class="fa fa-plus"></i> 添加商品信息</h3>
                </div><!-- /.box-header -->
                <!-- form start -->
                <form class="form-horizontal" method="post" action="{{url('admin/minfo')}}">
				  <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
                  <div class="box-body">
                    <div class="form-group">
                      <label for="inputEmail3" class="col-sm-2 control-label">商品名称</label>
                      <div class="col-sm-4">
                        <input type="text" class="form-control" name="name" placeholder="商品名称">
                      </div>
                    </div>
                    <div class="form-group">
                      <label for="inputEmail3" class="col-sm-2 control-label">商品简介</label>
                      <div class="col-sm-4">
                        <input type="text" class="form-control" name="brief" placeholder="商品简介">
                      </div>
                    </div>
					
					<div class="form-group">
                      <label for="inputEmail3" class="col-sm-2 control-label">商品板块</label>
                      <div class="col-sm-4" class="form-control">
						<select name="fid" class="form-control" id="fid">
								<option value="0" >&nbsp;&nbsp;种类划分</option>
							@foreach($forum as $forum)
								<option value="{{$forum->id}}" >&nbsp;&nbsp;{{$forum->name}}</option>
							@endforeach
						</select>
                      </div>
                    </div>
					<div class="form-group" id="gd" style="display:none">
                      <label for="inputEmail3" class="col-sm-2 control-label">商品类别</label>
                      <div class="col-sm-4" class="form-control">
					  <div id="mid"></div>
						<select name="gid" class="form-control" id="gid">
							<option value="0" >&nbsp;&nbsp;下属类别</option>
						</select>
                      </div>
                    </div>
					
					<div id="pag"></div>	
					
					@section("myscript")
					<script src="{{asset('myadmin/bootstrap/js/jquery-3.1.0.js')}}" type="text/javascript"></script>
					<script type="text/javascript">
						//加载添加表单
						$(function(){
							$("#fid").change(function(){
								gid.length=1;
								$("#gd").css("display","block");
								$.ajax({
									url:'{{url("admin/minfo")}}/'+$(this).val(),
									type:"get",
									dataType:"json",
									async:true,
									success:function(res){
										for(var i=0;i<res.length;i++){
											//创建一个下拉项，并添加到cid中
											gid.add(new Option(res[i].split("=>")[1],parseInt(res[i])));
										}
									},
								});	
							});
							$("#gid").change(function(){
								$.ajax({
									url:'{{url("admin/find")}}?gid='+$(this).val(),
									type:"get",
									dataType:"json",
									async:true,
									success:function(res){
										for(var i=0;i<res.length;i++){
											//创建一个下拉项，并添加到cid中
											$('#pag').html(res);
										}
									},
								});	
							});
						});		
					</script>
					@endsection
                   <!--  <div class="form-group">
                      <label for="inputEmail3" class="col-sm-2 control-label">商品颜色</label>
                      <div class="col-sm-4">
                        <input type="text" class="form-control" name="color" placeholder="商品颜色">
                      </div>
                    </div>	
                    <div class="form-group">
                      <label for="inputEmail3" class="col-sm-2 control-label">操作系统</label>
                      <div class="col-sm-4">
                        <input type="text" class="form-control" name="os" placeholder="操作系统">
                      </div>
                    </div>	
                    <div class="form-group">
                      <label for="inputEmail3" class="col-sm-2 control-label">屏幕尺寸</label>
                      <div class="col-sm-4">
                        <input type="text" class="form-control" name="screen" placeholder="屏幕尺寸">
                      </div>
                    </div>-->

                    <div class="form-group">
                      <label for="inputEmail3" class="col-sm-2 control-label">商品价格(￥)</label>
                      <div class="col-sm-4">
                        <input type="text" class="form-control" name="price" placeholder="商品价格">
                      </div>
                    </div>					
                    <div class="form-group">
                      <label for="inputEmail3" class="col-sm-2 control-label">商品数量</label>
                      <div class="col-sm-4">
                        <input type="text" class="form-control" name="number" placeholder="商品数量">
                      </div>
                    </div>
					<div class="form-group">
                      <label for="inputPassword3" class="col-sm-2 control-label">具体参数说明</label>
                      <div class="col-sm-10">
                        <textarea id="editor1" value="123" name="content" rows="10" style="resize:none " cols="52" ></textarea>
                      </div>
                    </div>
					<div class="form-group">
                      <label for="inputEmail3" class="col-sm-2 control-label">商品状态</label>
                      <div class="col-sm-4" class="form-control">
						<select name="status" class="form-control" id="level">
							<option value="wait" >&nbsp;&nbsp;新款</option>
							<option value="on" >&nbsp;&nbsp;热卖</option>
							<option value="off" >&nbsp;&nbsp;下架</option>
						</select>
                      </div>
                    </div><!-- /.box-body -->
                  <div class="box-footer">
				    <div class="col-sm-offset-2 col-sm-1">
						<button type="submit" class="btn btn-primary">添加</button>
                    </div>
					<div class="col-sm-1">
						<button type="reset"  class="btn btn-primary">重置</button>
					</div>
                  </div><!-- /.box-footer -->
                </form>
				<div class="row"><div class="col-sm-12">&nbsp;</div></div>
              </div><!-- /.box -->
            </div><!--/.col (right) -->
          </div>   <!-- /.row -->
        </section><!-- /.content -->
    @endsection